# !/usr/bin/env python
# -*- coding: utf-8 -*-
"""
 -------------------------------------------------
    File Name:     request_handler.py
    Description:   请求构建与执行模块
 -------------------------------------------------
 """

import requests


class RequestHandler:

    @staticmethod
    def send_request(endpoint, method='GET', params=None, data=None, headers=None):
        url = "https://api.example.com" + endpoint
        try:
            response = requests.request(method, url, params=params, json=data, headers=headers)
            return response
        except requests.exceptions.RequestException as e:
            print(f"Request failed: {e}")
            return None
